package com.dtdream.principle.singleresponsibility;

/**
 * 单一职责原则
 *
 * @Author: yewj
 **/
public class SingleResponsibilityOne {
    public static void main(String[] args) {
        Vehicle vehicle = new Vehicle();
        vehicle.run("摩托车");
        vehicle.run("飞机");
        vehicle.run("火车");
    }
}

/**
 * 1、违反了单一职责原则
 */
class Vehicle {
    public void run(String vehicle) {
        System.out.println(vehicle + "在公路上运行。。。。");
    }
}
